/**
 * 
 */
package com.testvideo.ui;

import java.awt.FileDialog;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JFrame;

/**
 * @author Administrator
 *
 */
public class OpenVideoFileAction extends AbstractAction {
	JFrame parent ;
	FleetPlayer fleet ;
	
	public OpenVideoFileAction(JFrame parent, FleetPlayer fleet){
		this.parent = parent ;
		this.fleet = fleet ;
		this.putValue(Action.NAME, "打开电影") ;
	}
	

	public void actionPerformed(ActionEvent e) {
		FileDialog fd = new FileDialog(parent, "选择播放文件", FileDialog.LOAD) ;
		fd.setVisible(true) ;
		
		String dir = fd.getDirectory() ;
		if(dir != null){
			String file = dir + fd.getFile() ;
			System.out.println("file is:" + file);
			fleet.getPlayer().playVideo(file, null) ;
		}				
	}

}
